import Vue from 'vue'
import VueRouter from 'vue-router'
import Home from '../views/Home.vue'
import HomePage from '../views/home/HomePage.vue'
import My from '../views/home/My.vue'
import Order from '../views/home/Order.vue'
import OrderDetails from '../views/home/order/OrderDetails.vue'
import Login from '../views/Login.vue'
import Search from '../views/Search.vue'
import Address from '../views/Address.vue'
import Food from '../views/Food.vue'
import Delicious from '../views/food/Delicious.vue'
import Complete from '../views/Complete.vue'
import Location from '../views/Location.vue'

Vue.use(VueRouter)

const routes = [
  {
    path: '/',
    name: 'home',
    component: Home,
    children: [
      {
        path: 'homepage',
        name: 'homepage',
        component: HomePage
      },
      {
        path: 'my',
        name: 'my',
        component: My
      },
      {
        path: 'order',
        name: 'order',
        component: Order,
        children: [
          {
            path: 'details',
            component: OrderDetails
          }
        ]
      },
      {
        path: '',
        redirect: '/homepage'
      }
    ]
  },
  {
    path: '/login',
    component: Login
  },
  {
    path: '/search',
    component: Search
  },
  {
    path: '/address',
    component: Address
  },
  {
    path: '/food',
    component: Food,
    children: [
      {
        path: '/delicious',
        component: Delicious
      }
    ]
  },
  {
    path: '/complete',
    component: Complete
  },
  {
    path: '/location',
    component: Location
  }
]

const router = new VueRouter({
  routes
})

export default router
